
#pragma once
#include <stdint.h>
#include "string.h"

namespace FlameEngine
{
	enum InputActionKey :uint16_t
	{
		iak_none = 0,

		//keyboard buttons
		iak_firstVirtualKey = 1,
		iak_a = 1,
		iak_add,
		iak_apps,
		iak_attn,
		iak_b,
		iak_back,
		iak_browserBack,
		iak_browserFavorites,
		iak_browserForward,
		iak_browserHome,
		iak_browserRefresh,
		iak_browserSearch,
		iak_browserStop,
		iak_c,
		iak_capsLock,
		iak_chatPadGreen,
		iak_chatPadOrange,
		iak_crsel,
		iak_clear,
		iak_d,
		iak_d0,
		iak_d1,
		iak_d2,
		iak_d3,
		iak_d4,
		iak_d5,
		iak_d6,
		iak_d7,
		iak_d8,
		iak_d9,
		iak_decimal,
		iak_delete,
		iak_divide,
		iak_down,
		iak_e,
		iak_end,
		iak_enter,
		iak_eraseEof,
		iak_escape,
		iak_execute,
		iak_exsel,
		iak_f,
		iak_f1,
		iak_f10,
		iak_f11,
		iak_f12,
		iak_f13,
		iak_f14,
		iak_f15,
		iak_f16,
		iak_f17,
		iak_f18,
		iak_f19,
		iak_f2,
		iak_f20,
		iak_f21,
		iak_f22,
		iak_f23,
		iak_f24,
		iak_f3,
		iak_f4,
		iak_f5,
		iak_f6,
		iak_f7,
		iak_f8,
		iak_f9,
		iak_g,
		iak_h,
		iak_help,
		iak_home,
		iak_i,
		iak_imeConvert,
		iak_imeNoConvert,
		iak_insert,
		iak_j,
		iak_k,
		iak_kana,
		iak_kanji,
		iak_l,
		iak_launchApplication1,
		iak_launchApplication2,
		iak_launchMail,
		iak_launchMediaSelect,
		iak_left,
		iak_leftAlt,
		iak_leftControl,
		iak_leftShift,
		iak_leftWindows,
		iak_m,
		iak_mediaNextTrack,
		iak_mediaPlayPause,
		iak_mediaPreviousTrack,
		iak_mediaStop,
		iak_multiply,
		iak_n,
		iak_next,
		iak_numLock,
		iak_numPad0,
		iak_numPad1,
		iak_numPad2,
		iak_numPad3,
		iak_numPad4,
		iak_numPad5,
		iak_numPad6,
		iak_numPad7,
		iak_numPad8,
		iak_numPad9,
		iak_o,
		iak_oem1,
		iak_oem2,
		iak_oem3,
		iak_oem4,
		iak_oem5,
		iak_oem6,
		iak_oem7,
		iak_oem8,
		iak_oem9,
		iak_oem0,
		iak_oemAuto,
		iak_oemBackslash,
		iak_oemClear,
		iak_oemCloseBrackets,
		iak_oemComma,
		iak_oemCopy,
		iak_oemEnlW,
		iak_oemMinus,
		iak_oemOpenBrackets,
		iak_oemPeriod,
		iak_oemPipe,
		iak_oemPlus,
		iak_oemQuestion,
		iak_oemQuotes,
		iak_oemSemicolon,
		iak_oemTilde,
		iak_p,
		iak_pa1,
		iak_pageDown,
		iak_pageUp,
		iak_pause,
		iak_play,
		iak_print,
		iak_printScreen,
		iak_prior,
		iak_processKey,
		iak_q,
		iak_r,
		iak_right,
		iak_rightAlt,
		iak_rightControl,
		iak_rightShift,
		iak_rightWindows,
		iak_return,
		iak_s,
		iak_scroll,
		iak_select,
		iak_selectMedia,
		iak_separator,
		iak_sleep,
		iak_space,
		iak_subtract,
		iak_t,
		iak_tab,
		iak_u,
		iak_up,
		iak_v,
		iak_volumeDown,
		iak_volumeMute,
		iak_volumeUp,
		iak_w,
		iak_x,
		iak_y,
		iak_z,
		iak_zoom,
		iak_shift,
		iak_ctrl,
		iak_alt,

		//mouse button
		iak_leftButton,
		iak_middleButton,
		iak_rightButton,
		iak_xButton1,
		iak_xButton2,
		iak_mouseWheel,
		iak_lastVritualKey,


		//other action start here
		iak_mouseMove,
	};

	enum InputDeviceType :uint8_t
	{
		idt_none,
		idt_keyboard,
		idt_mouse,
		idt_touch,
	};

	enum InputActionType :uint8_t
	{
		iat_none,
		iat_keyDown,
		iat_keyUp,
		iat_mouseWheel,
		iat_move,
	};

	class InputAction
	{
	public:
		InputActionKey GetActionKey() const;
		InputDeviceType GetInputDevice() const;
		InputActionType GetActionType() const;
		float GetValue(int i) const
		{
			if(i >= 0 && i<4)
				return m_value[i];
			return 0;
		}

		InputAction()
			:m_inputDevice(idt_none),m_actionType(iat_none),m_actionKey(iak_none)
		{
			memset(m_value,0,sizeof(m_value));
		}

		InputAction(InputDeviceType idt,InputActionType iat,InputActionKey iak)
			:m_inputDevice(idt),m_actionType(iat),m_actionKey(iak)
		{
			memset(m_value,0,sizeof(m_value));
		}

		InputAction(InputDeviceType idt,InputActionType iat,InputActionKey iak,float v1,float v2,float v3,float v4)
			:m_inputDevice(idt),m_actionType(iat),m_actionKey(iak)
		{
			m_value[0] = v1;
			m_value[1] = v2;
			m_value[2] = v3;
			m_value[3] = v4;
		}

	private:
		InputDeviceType m_inputDevice;
		InputActionType m_actionType;
		InputActionKey m_actionKey;
		float m_value[4];
	};	
}
